package com.hd.abc.newcctv.servlet.serIMPL;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hd.abc.newcctv.dao.userdao;
import com.hd.abc.newcctv.enityt.user;
import com.hd.abc.newcctv.servlet.ser;
import common.ResponseResult;
import common.ResultTable;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class serdaIMPL implements ser {

    @Resource
    private userdao dao;


    @Override
    public ResultTable getpage(int page, int limit) {
        PageHelper.startPage (page,limit);
        List<user> getall = dao.getall ();
        PageInfo pageInfo=new PageInfo (getall);
        return new ResultTable (0,"",(int) pageInfo.getTotal (),pageInfo.getList ());
    }

    @Override
    public ResponseResult getdata(String username, String password) {
        List<user> data =  dao.getdataone(username,password);
        return ResponseResult.getSuccess ();
    }
}
